/*   Copyright 2012 Fernando Moreno Ruiz All Rights Reserved.
 *
 * 	 This file is part of pyPhotosMixer.
 *
 *   pyPhotosMixer is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   pyPhotosMixer is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with pyPhotosMixer.  If not, see <http://www.gnu.org/licenses/>.
 * */
import QtQuick 1.1
import "../date"
Rectangle {
    width: Math.max(imageFile.width + 6,textFileName.paintedWidth+textDate.paintedWidth + 20)
    height: parent.height
    property variant listPhotos;
    color:(index==listPhotos.selectedIndex)?"yellow":"white"
    Rectangle{
        anchors.centerIn: parent
    }
    Component.onCompleted: {
        console.log("AAAAAA:"+index);
    }

    Image{
        id:imageFile
        property int genericMarginTop: 5
        anchors.top: parent.top
        anchors.topMargin: genericMarginTop
        anchors.horizontalCenter: parent.horizontalCenter
        source:thumbail
        fillMode: Image.PreserveAspectFit
        height: parent.height-textFileName.paintedHeight - genericMarginTop
        onSourceChanged: {
            console.log("sourceChanged:"+ source)
        }

    }
    Text{
        id:textFileName
        text:fileName
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.leftMargin: 5
    }
    Text{
        id: textFerFormatDate
        text:ferFormat.dateShow
        anchors.left:textFileName.right
        anchors.bottom: textFileName.top
//        anchors.bottomMargin: 1
        anchors.leftMargin: 5
        color: "green"
        font.bold: true
        FerFormat{
            id:ferFormat
            file:fileName
        }
    }
    Text{
        id:textDate
        anchors.left:textFileName.right
        anchors.top: textFileName.top
        anchors.leftMargin: 5
        color: "blue"
        font.bold: true
        text: exif
    }
    MouseArea{
        anchors.centerIn:  parent
        width: parent.width+2
        height: parent.height
        onClicked: {
            console.log("SELECTED:"+listPhotos.selectedIndex)
            console.log("INDEX:"+index)
            listPhotos.selectedIndex = index
        }


    }
}
